#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''
读取配置.   YAML
'''

import os 
from file_reader import YamlReader

# 通过当前文件的绝对路径，其父级目录一定是框架的 base 目录，然后确定各层的绝对路径。
BASE_PATH = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
CONFIG_FILE = os.path.join(BASE_PATH,'config','config.yml')
DATA_PATH = os.path.join(BASE_PATH,'data')
DRIVER_PATH = os.path.join(BASE_PATH,'drivers')
LOG_PATH = os.path.join(BASE_PATH,'log')
REPORT = os.path.join(BASE_PATH,'report')


class Config(object):
    
    def __init__(self,config=CONFIG_FILE):
        self.config = YamlReader(config).data

    def get(self,element,index=0):
        return self.config[index].get(element)

    def log(self,index=1):
        return self.config[index]

if __name__ == '__main__':
    c = Config()
    print(c.log())
   

